let mongoose = require('mongoose');
mongoose.connect('mongodb://admin:admin@127.0.0.1:27017/bbkdb?authSource=admin');
let db = mongoose.connection;

db.on('error', () => {
    console.log('连接失败');
});

db.once('open', () => {
    console.log('连接成功');
});

db.once('close', () => {
    console.log('断开连接');
});

module.exports = mongoose;